package com.goldsprite.gameframeworks.ecs.component;

import com.badlogic.gdx.graphics.g2d.Batch;
import com.goldsprite.gameframeworks.utils.math.Vector2;

public class RenderableComponent extends Component {
	protected final Vector2 originOffset = new Vector2(); // 原点距左下偏移
	protected final Vector2 leftDownPos = new Vector2();
	private String spriteLayer = "";

	public Vector2 getOriginOffset() {
		return originOffset;
	}
	public void setOriginOffset(float offsetX, float offsetY) {
		this.originOffset.set(offsetX, offsetY);
	}

	public Vector2 getLeftDownPos() {
		return leftDownPos.set(originOffset).scl(getTransform().getScale()).add(getTransform().getPosition());
	}

	public String getSpriteLayer() {
		return spriteLayer.isEmpty() ? "Default" : spriteLayer;
	}
	public void setSpriteLayer(String spriteLayer) {
		String oldSpriteLayer = getSpriteLayer();
		this.spriteLayer = spriteLayer;
//		GameSystem.spriteRenderer.refreshSpriteLayer(this, oldSpriteLayer);
	}

	public void render(Batch batch, float delta){
	}
}
